package com.wanrue.tcc.enums;

public enum Result {

    /**
     * 初始化状态
     */
    INITIAL(0),

    /**
     * 成功状态
     */
    SUCCESS(1),

    /**
     * 失败状态
     */
    FAILURE(-1);

    private int value;

    private Result(int value) {
        this.value = value;
    }

    public int value() {
        return this.value;
    }

    public static Result valueOf(int id) {
        switch (id) {
            case 0:
                return INITIAL;
            case 1:
                return SUCCESS;
            case -1:
                return FAILURE;
            default:
                return null;
        }
    }
}
